/**
 *
 * @author Eric Hushagen
 * Simple script that returns "PONG" to a player's "ping"
 * Updated for hey0 v115+
 *
 */

import java.util.logging.Logger;
import java.util.List;

public class ehPingPong extends Plugin {

    protected static final Logger log = Logger.getLogger("Minecraft");

    static final ehPingPongListener listener = new ehPingPongListener();
    
    public void enable() {
        log.info("ehPingPong plugin enabled");
        tellMods("ehPingPong plugin enabled");
    }

    public void disable() {
        log.info("ehPingPong plugin disabled");
        tellMods("ehPingPong plugin disabled");
    }

    public void initialize() {
        etc.getLoader().addListener(PluginLoader.Hook.CHAT, listener, this, PluginListener.Priority.MEDIUM);
    }

    public void tellMods(String message) {
        List<Player> pList = etc.getInstance().getServer().getPlayerList();
        for (Player p : pList) {
            if (p.isInGroup("mods")) {
                p.sendMessage(Colors.Rose + message);
            }
        }
    }

    
}
